<script setup>
	import { ref } from 'vue'
	import { artGetChannelsService } from '@/api/article'
	//
	defineProps({
		modelValue: {
			type: [Number, String]
		},
		width: {
			type: String,
			default() {
				return '240px'
			}
		}
	})
	const emit = defineEmits(['update:modelValue'])
	const channelList = ref([])
	const getChannelList = async () => {
		const res = await artGetChannelsService()
		channelList.value = res.data.data
		// console.log(res)
	}
	getChannelList()
</script>
<template>
	<el-select
		size="large"
		placeholder="请选择文章类型"
		:modelValue="modelValue"
		@update:modelValue="emit('update:modelValue', $event)"
		:style="{ width }"
	>
		<el-option
			v-for="channel in channelList"
			:label="channel.cate_name"
			:key="channel.id"
			:value="channel.id"
		>
		</el-option>
	</el-select>
</template>
